<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:kuo="http://kuonta.com.br/jsf/facelets/tags">
<body>

<ui:composition template="/WEB-INF/templates/layout.xhtml">

	<ui:define name="body">
		<a4j:loadScript src="/js/moeda.js"></a4j:loadScript>		
			<rich:panel>
				<f:facet name="header">
					<h:outputText value="Depositos" />
				</f:facet>
				<kuo:mensagens />
				<h:form id="formDeposito">
				<table>
					<tbody>
						<tr>
							<td><label>Data:</label></td>
							<td>
								<rich:calendar datePattern="dd/MM/yyyy" label="Data"
									id="data" enableManualInput="true" required="true"
									value="#{formDeposito.bean.data}" />
							</td>
							<td><rich:message for="data" /></td>
						</tr>
						<tr>
							<td><label>Valor:</label></td>
							<td>
								<h:inputText id="valor" label="Valor" converter="moedaConverter"
									value="#{formDeposito.bean.valor}" size="40" required="true" />
							</td>
							<td><rich:message for="valor" /></td>
						</tr>						
					</tbody>
				</table>

				<h:panelGrid columns="1">
					<h:panelGroup />
					<a4j:commandButton id="gravar" value="Gravar"
						actionListener="#{formDeposito.save}"
						reRender="formDeposito, formMensagens, lista" />
				</h:panelGrid>
				</h:form>

				<hr />
				<a4j:form id="lista">
				<rich:dataTable onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
                    onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                    cellpadding="0" cellspacing="0" 
                    width="100%" border="0" var="item" value="#{formDeposito.list}">
					<f:facet name="header">
                        <rich:columnGroup>
                            <rich:column width="50">
                                <h:outputText value="Data" />
                            </rich:column>
                            <rich:column>
                                <h:outputText value="Valor" />
                            </rich:column> 
							<rich:column>
                                <h:outputText value="" />
                            </rich:column>
							<rich:column>
                                <h:outputText value="" />
                            </rich:column>                           
                        </rich:columnGroup>
                    </f:facet>
					<rich:column>
                    	<h:outputText value="#{item.data}" />
                   	</rich:column>
                   	<rich:column>
                       	<h:outputText value="#{item.valor}" />
                   	</rich:column> 
					<rich:column width="30">
                    	<center>
					  	  <a4j:region>
					  	  	<a4j:commandLink actionListener="#{formDeposito.edit}"
								onclick="var x= confirm('Deseja realmente editar esse registro ?');if(!x){return false;}"
								reRender="formDeposito,formMensagens">
								<img border="0" src="/kuonta/img/edit.gif"/>
								<f:param name="id" value="#{item.id}" />
							</a4j:commandLink>
					  	  </a4j:region>
						</center>
                   	</rich:column>
					<rich:column width="30">
                    	<center>
					  	  <a4j:region>
					  	  	<a4j:commandLink actionListener="#{formDeposito.delete}"
								onclick="var x= confirm('Deseja realmente deletar esse registro ?');if(!x){return false;}"
								reRender="formDeposito,formMensagens, lista">
								<img border="0" src="/kuonta/img/error.gif"/>
								<f:param name="id" value="#{item.id}" />
							</a4j:commandLink>
					  	  </a4j:region>
						</center>
                   	</rich:column>  
				</rich:dataTable>
				<a4j:keepAlive beanName="formDeposito" />
				</a4j:form>
			</rich:panel>
<script src="/kuonta/js/jquery.mask.js" type="text/javascript">x</script>
<script>
    jQuery( function($) {
        $j("#formDeposito\\:dataInputDate").mask("99/99/9999");
    });       
</script>
<script type="text/javascript">
	$j("#formDeposito\\:valor").keypress( function(e) {
		sg_keyPressMoeda(this, e);
	});
	$j("#formDeposito\\:valor").keydown( function(e) {
		sg_keyDownMoeda(this, e);
	});
	$j("#formDeposito\\:valor").blur( function(e) {
		sg_blurMoeda(this);
	});
	$j("#formDeposito\\:valor").keyup( function(e) {
		moedaOnFly(this);
	});
	$j("#formDeposito\\:valor").keyup( function(e) {
		moedaOnFly(this);		
	});
</script>

	</ui:define>

</ui:composition>

</body>
</html>
